# encoding: utf-8

import sys

__author__ = 'user'
# 读文件
with open(r"..\Base\qy.bat") as f:
    for line in f:
        sys.stdout.write(line)

# filelike object 流对象
print
# 读取二进制文件

# 读取非Ascii编码文件
with open(r"testIoFile.txt") as f:
    u = f.read().decode("utf-8")
    print(u)
print
# 写文件
import codecs

with codecs.open(r"WriteGBKFile.txt", "r", "gbk") as f:
    print( f.read() )

# 操作目录

import os
print(os.name) #
# print os.uname() windows 不支持
print os.getenv("PATH")[0]
nowPath = os.path.abspath(".")
# 创建新目录 目录函数并不对真实目录情况进行验证
newPath = os.path.join(nowPath,"csv2")
if os.path.exists(newPath):
    os.rmdir(newPath)
else:
    os.mkdir(newPath)

print(os.path.split(newPath))

import shutil
# 该模块对os模块进行了补充 例如 文件复制
print [x for x in os.listdir(nowPath) if os.path.isdir(x)] # 列表表达式后缀条件语句 筛选结果

listOddNum